package com.hns.phone.maintenance.service;

import com.hns.can.base.entity.SysUserEntity;
import com.hns.can.common.aop.orgTree.DriverInterfaceAnnotation;
import com.hns.can.common.aop.orgTree.LeftOrgAnnotation;
import com.hns.can.common.constants.GlobalConst;
import com.hns.can.common.entity.BaseEntity;
import com.hns.can.common.formula.FillCodeDscValue;
import com.hns.can.common.formula.FillParamsVo;
import com.hns.can.mainte.entity.CommEngiStInfoEntity;
import com.hns.can.mainte.vo.EngineRunStatusParamVo;
import com.hns.frame.enumrate.MsgType;
import com.hns.frame.exception.BusinessException;
import com.hns.frame.mybatis.Pagination;
import com.hns.frame.service.CommonService;
import com.hns.phone.common.vo.PhoneParamsVo;
import com.hns.phone.entity.AppCarMaintenInfoEntity;
import com.hns.phone.entity.AppCarMaintenRmndrInfoEntity;
import com.hns.phone.maintenance.vo.*;
import com.hns.tool.pub.PubUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;

@Service
public class PhoneEngineManageService extends CommonService {

    @Autowired
    private FillCodeDscValue codeDscValue;

    private void fillInfoValue(List list) throws Exception {
        Map<String, String> map = new HashMap<String, String>();
        map.put("lineName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo1 = new FillParamsVo("lineId", map);
        map = new HashMap<String, String>();
        map.put("organName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo2 = new FillParamsVo("organId", map);
        map = new HashMap<String, String>();
        map.put("licPltNo", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo3 = new FillParamsVo("carId", map);
        map = new HashMap<String, String>();
        map.put("drvName", GlobalConst.DEFAULT_CACHE_VALUE);
        FillParamsVo vo4 = new FillParamsVo("drvId", map);
        codeDscValue.fillInfoValue(list, new String[]{GlobalConst.CACHE_KEY_BASE_LINE_INFO, GlobalConst.CACHE_KEY_BASE_ORGAN, GlobalConst.CACHE_KEY_BASE_CAR_INFO, GlobalConst.CACHE_KEY_BASE_DRV_INFO}, vo1, vo2, vo3, vo4);
    }

    /**
     * 查询发动机运行状态数据
     *
     * @param conditionVo
     * @return
     * @throws Exception
     */
    @LeftOrgAnnotation()
    @Transactional
    @DriverInterfaceAnnotation()
    public List<BaseEntity> searchEngineRunStatusList(EngineRunStatusParamVo conditionVo) throws Exception {
        List list = PubUtil.convertListMapToObject(this.sqlMapDao.selectList("engineManage.getEngineRunStatusList4App", conditionVo), CommEngiStInfoEntity.class);
        fillInfoValue(list);
        return list;
    }

}
